import Vue from 'vue'
import App from './app.vue'
import VueRouter from 'vue-router'
import createStore from './store/store.js'
import './assets/scss/global.scss'
import createRouter from './config/router.js'
import Vuex from 'vuex'
Vue.use(Vuex)
Vue.use(VueRouter)
const store = createStore()
const router = createRouter()
// store.registerModule('c', {
//   state: {
//     text: 'textc'
//   }
// })
store.subscribe((mutation, state) => {
  console.log('subscribe:' + mutation.type)
  console.log('subscribe:' + mutation.payload)
})
store.subscribeAction((acton, state) => {
  console.log('subscribeAction:' + acton.type)
  console.log('subscribeAction:' + acton.payload)
})
// const root = document.createElement('div')
// document.body.insertAdjacentElement('afterbegin', root)
router.beforeEach((to, from, next) => {
  // console.log('beforeEach invoke')
  next()
})
router.beforeResolve((to, from, next) => {
  // console.log('beforeResolve invoke')
  next()
})
router.afterEach((to, from) => {
  // console.log('afterEach invoke')
})

new Vue({
  router,
  store,
  render: (h) => h(App)
}).$mount('#root')
